package com.kexinde.wjifen.model;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;

/**
 * 
 * @author wei
 * 
 * 消费记录
 *
 */
@Entity
public class ConsumptionRecord {

	private long id;  // 标识（主键）
	private Date time;  //  消费日期时间
	private Double money;  // 消费金额
	private NormalUser normalUser;  // 普通用户
	private Shop shop;  // 店铺
	private long workerId;  // 员工编号
	
	public ConsumptionRecord(){}

	@Id
	@GeneratedValue
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public Date getTime() {
		return time;
	}

	public void setTime(Date time) {
		this.time = time;
	}

	public Double getMoney() {
		return money;
	}

	public void setMoney(Double money) {
		this.money = money;
	}

	@ManyToOne(cascade=CascadeType.ALL)
	public NormalUser getNormalUser() {
		return normalUser;
	}

	public void setNormalUser(NormalUser normalUser) {
		this.normalUser = normalUser;
	}

	@ManyToOne(cascade=CascadeType.ALL)
	public Shop getShop() {
		return shop;
	}

	public void setShop(Shop shop) {
		this.shop = shop;
	}

	@Column(name="worker_id")
	public long getWorkerId() {
		return workerId;
	}

	public void setWorkerId(long workerId) {
		this.workerId = workerId;
	}

	@Override
	public String toString() {
		return "ConsumptionRecord [id=" + id + ", time=" + time + ", money="
				+ money + ", normalUser=" + normalUser + ", shop=" + shop
				+ ", workerId=" + workerId + "]";
	}

}
